<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  
  <title>Matrix207&#39;s Blog</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:type" content="website">
<meta property="og:title" content="Matrix207's Blog">
<meta property="og:url" content="http://yoursite.com/page/8/index.html">
<meta property="og:site_name" content="Matrix207's Blog">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Matrix207's Blog">
  
    <link rel="alternate" href="/atom.xml" title="Matrix207&#39;s Blog" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png">
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  
  <link rel="stylesheet" href="/css/style.css">
  

</head>

<body>
  <div id="container">
    <div id="wrap">
      <header id="header">
  <div id="banner"></div>
  <div id="header-outer" class="outer">
    <div id="header-title" class="inner">
      <h1 id="logo-wrap">
        <a href="/" id="logo">Matrix207&#39;s Blog</a>
      </h1>
      
    </div>
    <div id="header-inner" class="inner">
      <nav id="main-nav">
        <a id="main-nav-toggle" class="nav-icon"></a>
        
          <a class="main-nav-link" href="/">Home</a>
        
          <a class="main-nav-link" href="/archives">Archives</a>
        
      </nav>
      <nav id="sub-nav">
        
          <a id="nav-rss-link" class="nav-icon" href="/atom.xml" title="Flux RSS"></a>
        
        <a id="nav-search-btn" class="nav-icon" title="Rechercher"></a>
      </nav>
      <div id="search-form-wrap">
        <form action="//google.com/search" method="get" accept-charset="UTF-8" class="search-form"><input type="search" name="q" results="0" class="search-form-input" placeholder="Search"><button type="submit" class="search-form-submit">&#xF002;</button><input type="hidden" name="sitesearch" value="http://yoursite.com"></form>
      </div>
    </div>
  </div>
</header>
      <div class="outer">
        <section id="main">
  
    <article id="post-iscsi" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/24/iscsi/" class="article-date">
  <time datetime="2014-06-23T16:00:00.000Z" itemprop="datePublished">2014-06-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/24/iscsi/">iSCSI</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="What-is-ISCSI"><a href="#What-is-ISCSI" class="headerlink" title="What is ISCSI"></a>What is ISCSI</h3><p>iSCSI是由IEETF开发的网络存储标准，目的是为了用IP协议将存储设备连接在一起。</p>
<h3 id="Why-need-iSCSI"><a href="#Why-need-iSCSI" class="headerlink" title="Why need iSCSI"></a>Why need iSCSI</h3><ol>
<li>解决了SCSI协议在设备数目和连接距离上的限制;</li>
<li>为SAN提供了一种高性价比的传输协议；</li>
<li>与各种存储管理结合起来，提供灵活的备份、镜像、灾难恢复以及次级存储解决方案；</li>
</ol>
<h3 id="iSCSI-的存储连接方式"><a href="#iSCSI-的存储连接方式" class="headerlink" title="iSCSI 的存储连接方式"></a>iSCSI 的存储连接方式</h3><ol>
<li><p>iSCSI HBA卡连接方式（硬iSCSI）：<br>在主机上安装专业的iSCSI HBA适配卡，从而实现主机与交换机之间、主机与存储之间的<br>高效数据交换。传输性能好，价格高。</p>
</li>
<li><p>以太网卡+initiator软件方式（软iSCSI）：<br>服务器、工作站等主机使用标准的以太网卡，通过以太网线直接与以太网交换机连接，<br>iSCSI存储也通过以太网线连接到以太网交换机上，或直接连接到主机的以太网卡上。<br>在主机上安装Initiator软件，Initiator软件可以将以太网卡虚拟为iSCSI卡，接受和发<br>送iSCSI数据报文，从而实现主机和iSCSI设备之间的iSCSI协议和TCP/IP协议传输功能。</p>
</li>
</ol>
<h3 id="Compile-and-install"><a href="#Compile-and-install" class="headerlink" title="Compile and install"></a>Compile and install</h3><p>The iSCSI target consists of a kernel module (iscsi_trgt.ko) , daemon<br>(ietd) and control utility (ietadm).</p>
<ul>
<li>Compile</li>
</ul>
<ol>
<li>build all: <code>make</code></li>
<li>build component: <code>make kernel</code> or <code>make usr</code></li>
</ol>
<ul>
<li>install</li>
</ul>
<ol>
<li>Install all: <code>make [KSRC=&lt;kernel-src&gt;] install</code></li>
<li><p>Install individual components:</p>
<p> make [KSRC=<kernel-src>] install-kernel - for kernel module<br> make [KSRC=<kernel-srv>] install-usr - for daemon and utility<br> make [KSRC=<kernel-srv>] install-init - for init.d script<br> make [KSRC=<kernel-srv>] install-etc - for config files</kernel-srv></kernel-srv></kernel-srv></kernel-src></p>
</li>
</ol>
<p>ietd and ietadm will be install in /usr/sbin<br>iscsi-target was install in /etc/init.d/<br>ietd.conf and initiators.{allow,denny} were install in /etc</p>
<ul>
<li><p>start stop</p>
<p>  /etc/init.d/iscsi-target start<br>  /etc/init.d/iscsi-target stop</p>
</li>
</ul>
<h3 id="iet基本配置和命令"><a href="#iet基本配置和命令" class="headerlink" title="iet基本配置和命令"></a>iet基本配置和命令</h3><p><strong>iet主要配置</strong></p>
<p>主要包括以下配置文件</p>
<pre><code>/etc/ietd.conf ：iet的主配置文件
/etc/initiators.allow：控制initiator对target的访问权限
/etc/initiators.deny：控制initiator对target的访问权限
/etc/targets.allow：控制不同target的被访问权限
</code></pre><p>通过/etc/ietd.conf, iet实现iSCSI Target的基本功能.</p>
<p>iSCSI Target的命名，命名在同一子网内应该是唯一。</p>
<pre><code>Target  target名称
其中：
target 名称：是iSCSI Target名称。一般iSCSI Target命名采用
    “iqn.yyyy-mm.&lt;reversed domain name&gt;: identifier 识别代号”的格式。
</code></pre><p>将块设备、文件、LVM卷、RAID卷作为块设备映射给iSCSI initiator使用。 </p>
<pre><code>Lun  &lt;lunID&gt; Path=&lt;device&gt;,Type=fileio|blockio[,IOMode=(wb|ro)]
其中：
&lt;lunID&gt;：是Lun的编号从0开始，最大2^14-1。
Path=&lt;device&gt;：指定块设备。可以使用dd命令生成一个文件。
Type=fileio|blockio：指定块设备类型，分区及dd命令生成的文件使用fileio类型；
    LVM卷、RAID卷使用blockio类型。
IOMode=(wb|ro)：指定iSCSI initiator允许的操作，wb表示可读写；ro表示只读。
</code></pre><p>配置完后重起iscsi-target，initiator即可连接使用.</p>
<p><strong>iet其它配置</strong></p>
<p>通过命令方式配置的iSCSI Target在重启后会失效。</p>
<pre><code>添加一个新的Target。其中[id]为数字却必须唯一，Name需自定义，也要唯一。
ietadm --op new --tid=[id] --params Name=iqn.zqin.example

添加一个新的lun。其中[id]必须是一个已存在的tid号，[lun]从0开始。
ietadm --op new --tid=[id] --lun=[lun] --params Path=/path/exported/file,Type=fileio
</code></pre><p><strong>iet常用命令</strong></p>
<pre><code>查看当前iSCSI Target清单。 
cat /proc/net/iet/volume

查看当前服务器iSCSI Target服务以及连接状态命令
cat /proc/net/iet/sessions

停止某个Target 的某个 Connection 的连接。
ietadm --op delete --tid=2 --sid=562950876233792 --cid=1  &amp;&amp; ietadm --op delete --tid=2

停止所有Target 的连接。
ietadm --op delete

删除某个Target （已经没有 Session 连接的）。
ietadm --op delete --tid= 1
</code></pre><p><strong>完整操作如下</strong>:</p>
<pre><code>[root@ ~]# dd if=/dev/zero of=/root/iscsi.disk bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 9.30143 s, 115 MB/s
[root@ ~]# echo &quot;Target iqn.2014-06.com.matrix:storage.515.disk&quot; &gt;&gt; /etc/ietd.conf
[root@ ~]# echo &quot;Lun 0 Path=/root/iscsi.disk,Type=fileio&quot;&gt;&gt;/etc/ietd.conf
[root@ ~]# echo &quot;Alias lun0&quot;&gt;&gt;/etc/ietd.conf
[root@ ~]# cat /etc/ietd.conf 
Target iqn.2014-06.com.matrix:storage.515.disk
Lun 0 Path=/root/iscsi.disk,Type=fileio
Alias lun0
[root@ ~]# echo &quot;iqn.2014-06.com.matrix:storage.515.disk 172.16.*.*&quot;&gt;&gt; /etc/initiators.allow
[root@ ~]# cat /etc/initiators.allow 
iqn.2014-06.com.matrix:storage.515.disk 172.16.*.*
[root@ ~]# netstat -tulpn | grep 3260 
tcp     0      0 172.16.110.10:3260   0.0.0.0:*  LISTEN  12147/ietd 
[root@ ~]# cat /proc/net/iet/session 
tid:1 name:iqn.2014-06.com.matrix:storage.515.disk
[root@ ~]# cat /proc/net/iet/volume 
tid:1 name:iqn.2014-06.com.matrix:storage.515.disk
    lun:0 state:0 iotype:fileio iomode:wt blocks:2097152 blocksize:512 path:/root/iscsi.disk

[root@ ~]# /etc/init.d/iscsi-target restart
Stopping iSCSI Target:                                     [  OK  ]
Starting iSCSI Target: FATAL: Error inserting crc32c_intel (/lib/modules/2.6
.32-279.el6.x86_64/kernel/arch/x86/crypto/crc32c-intel.ko): No such device
                                                           [  OK  ]
</code></pre><p>上面的错误是因为centos 6.3, kernel 2.6.32-279.el6.x86_64, 该版本已不需要<br>crc32c_intel.ko模块，可以过屏蔽脚本<code>/etc/init.d/iscsi-target</code>中的<br><code>modprobe -q crc32</code>来解决该错误信息。</p>
<pre><code>[root@ ~]# /etc/init.d/iscsi-target restart
Stopping iSCSI Target:                                     [  OK  ]
Starting iSCSI Target:                                     [  OK  ]
[root@ ~]# service iscsi-target status
iSCSI Target (pid 12147) is running...
</code></pre><h3 id="iSCSI-initiator"><a href="#iSCSI-initiator" class="headerlink" title="iSCSI initiator"></a>iSCSI initiator</h3><p>安装 <code>yum install iscsi-initiator-utils</code></p>
<p>iscsiadm是基于命令行的iscsi管理工具，提供对iscsi节点、会话、连接以及发现记录的操作。<br>涉及的主要操作如下:</p>
<ol>
<li>发现iscsi存储: iscsiadm -m discovery -t st -p ISCSI_IP</li>
<li>查看iscsi发现记录 iscsiadm -m node</li>
<li>删除iscsi发现记录 iscsiadm -m node -o delete -T LUN_NAME -p ISCSI_IP</li>
<li>登录iscsi存储 iscsiadm -m node -T LUN_NAME -p ISCSI_IP -l</li>
<li>登出iscsi存储 iscsiadm -m node -T LUN_NAME -p ISCSI_IP -u</li>
<li>登录全部iscsi存储 iscsiadm -m node -L all</li>
<li>登出全部iscsi存储 iscsiadm -m node -U all</li>
<li>查看session iscsiadm -m session</li>
<li><p>设置CHAP, vim /etc/iscsi/iscsid.conf, 或这使用下面的命令设置: </p>
<p>   [root@localhost ~]# iscsiadm -m node -T iqn.2007-10.lio.com:dg3.liolv1 -p 172.16.130.100 -o update –name node.session.auth.authmethod –value=CHAP<br>   [root@localhost ~]# iscsiadm -m node -T iqn.2007-10.lio.com:dg3.liolv1 -p 172.16.130.100 -o update –name node.session.auth.username –value=alan<br>   [root@localhost ~]# iscsiadm -m node -T iqn.2007-10.lio.com:dg3.liolv1 -p 172.16.130.100 -o update –name node.session.auth.password –value=123555<br>   [root@localhost ~]# iscsiadm -m node -T iqn.2007-10.lio.com:dg3.liolv1 -p 172.16.130.100 –login<br>注意:<br>要先使用发现discovery，然后才能登陆login，否则会出现错误“iscsiadm: No records found”</p>
</li>
</ol>
<p>下面是详细的操作：(<strong>注意:括号内容为注释说明</strong>)</p>
<pre><code>[root@localhost dennis]# fdisk -l

Disk /dev/sda: 149 GiB, 160000000000 bytes, 312500000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00007f87

Device    Boot     Start       End    Blocks  Id System
/dev/sda1 *         2048   1026047    512000  83 Linux
/dev/sda2        1026048 312498175 155736064  8e Linux LVM

(...此处省略不必要的内容...)
[root@localhost dennis]# iscsiadm -m discovery -t st -p 172.16.110.10
172.16.110.10:3260,1 iqn.2014-06.com.matrix:storage.515.disk
[root@localhost dennis]# iscsiadm -m node -T iqn.2014-06.com.matrix:storage.515.disk -p 172.16.110.10 -l
Logging in to [iface: default, target: iqn.2014-06.com.matrix:storage.515.disk, portal: 172.16.110.10,3260] (multiple)
Login to [iface: default, target: iqn.2014-06.com.matrix:storage.515.disk, portal: 172.16.110.10,3260] successful.
[root@localhost dennis]# fdisk -l

Disk /dev/sda: 149 GiB, 160000000000 bytes, 312500000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00007f87

Device    Boot     Start       End    Blocks  Id System
/dev/sda1 *         2048   1026047    512000  83 Linux
/dev/sda2        1026048 312498175 155736064  8e Linux LVM

(...此处省略不必要的内容...)
(成功连接后,多出一块磁盘/dev/sdb，大小刚好是前面dd创建的1G文件)
Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@localhost dennis]# iscsiadm -m node -T iqn.2014-06.com.matrix:storage.515.disk -p 172.16.110.10 -u
Logging out of session [sid: 1, target: iqn.2014-06.com.matrix:storage.515.disk, portal: 172.16.110.10,3260]
Logout of [sid: 1, target: iqn.2014-06.com.matrix:storage.515.disk, portal: 172.16.110.10,3260] successful.
[root@localhost dennis]# 
</code></pre><p>连接成功后，iet端显示如下：</p>
<pre><code>[root@ ~]# cat /proc/net/iet/session
tid:1 name:iqn.2014-06.com.matrix:storage.515.disk
    sid:562949990973952 initiator:iqn.1994-05.com.redhat:7d366003913
        cid:0 ip:172.16.50.39 state:active hd:none dd:none    tip:172.16.110.10
</code></pre><p>第一次连接时，磁盘是还没有分区化, 磁盘分区：</p>
<pre><code>[root@localhost dennis]# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.24.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0xf1eb4d09.

Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Save &amp; Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty DOS partition table
   s   create a new empty Sun partition table


Command (m for help): g
Created a new GPT disklabel (GUID: 22C002F1-D9F7-4E4C-8F89-9EFEBB971A1D).

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (2048-2097118, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-2097118, default 2097118): 

Created a new partition 1 of type &apos;Linux filesystem&apos; and of size 1023 MiB.

Command (m for help): p
Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 22C002F1-D9F7-4E4C-8F89-9EFEBB971A1D

Device    Start          End   Size Type
/dev/sdb1  2048      2097118  1023M Linux filesystem

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

[root@localhost dennis]# fdisk -l

Disk /dev/sda: 149 GiB, 160000000000 bytes, 312500000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00007f87

Device    Boot     Start       End    Blocks  Id System
/dev/sda1 *         2048   1026047    512000  83 Linux
/dev/sda2        1026048 312498175 155736064  8e Linux LVM

(...此处省略不必要的内容...)

Disk /dev/sdb: 1 GiB, 1073741824 bytes, 2097152 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 22C002F1-D9F7-4E4C-8F89-9EFEBB971A1D

Device    Start          End   Size Type
/dev/sdb1  2048      2097118  1023M Linux filesystem
</code></pre><p>分区完毕后，对磁盘该分区进行格式化：</p>
<pre><code>[root@localhost dennis]# mkfs.ext3 /dev/sdb1
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 261883 blocks
13094 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
</code></pre><p>格式化完毕后,进行挂载，然后就可以像对待本地目录一样进行相关操作了(拷贝、删除等)<br><strong>注：下一次登陆iscsi卷后，不用进行分区、格式化了，直接挂载就可以使用了</strong></p>
<pre><code>[root@localhost dennis]# mkdir /mnt/iscsi
[root@localhost dennis]# mount /dev/sdb1 /mnt/iscsi
[root@localhost dennis]# ls /mnt/iscsi/
lost+found
[root@localhost dennis]# cp Downloads/VirtualBox-4.3-4.3.12_93733_fedora18-1.x86_64.rpm /mnt/iscsi/
[root@localhost dennis]# ls -lh /mnt/iscsi/
total 74M
drwx------. 2 root root 16K Jun 27 12:10 lost+found
-rw-r--r--. 1 root root 74M Jun 27 12:13 VirtualBox-4.3-4.3.12_93733_fedora18-1.x86_64.rpm
[root@localhost dennis]# 
</code></pre><h3 id="Initiator-for-windows"><a href="#Initiator-for-windows" class="headerlink" title="Initiator for windows"></a>Initiator for windows</h3><p>login with batch script </p>
<pre><code>@echo off
for /l %%j in (1,1,2) do (
    for /l %%k in (0,1,49) do (
        iscsicli logintarget iqn.2007-10.cbxa.com:r5%%j.aa%%k T 192.168.166.100 3260 * * * * * * * * * * * * * 0       
    )
)
pause
</code></pre><p>使用用户名(aa0~aa49)和密码(123456789012)登陆:</p>
<pre><code>iscsicli logintarget iqn.2007-10.cbxa.com:r5%%j.aa%%k T 192.168.166.100 3260 * * * * * * * * * aa%%k 123456789012  1 * 0
</code></pre><h3 id="Protocol"><a href="#Protocol" class="headerlink" title="Protocol"></a>Protocol</h3><p><img src="/assets/image/posts/iscsi/iscsi_010.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_011.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_026.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_027.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_028.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_029.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_030.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_031.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_032.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_033.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_034.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_035.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_036.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_037.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_038.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_039.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_040.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_041.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_042.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_043.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_044.png" alt=""><br><img src="/assets/image/posts/iscsi/iscsi_045.png" alt=""></p>
<h3 id="iSCSI-initiator与iSCSI-target："><a href="#iSCSI-initiator与iSCSI-target：" class="headerlink" title="iSCSI initiator与iSCSI target："></a>iSCSI initiator与iSCSI target：</h3><ol>
<li><a href="http://unh-iscsi.sourceforge.net/" target="_blank" rel="external">UNH iSCSI</a></li>
<li><a href="http://iscsitarget.sourceforge.net/" target="_blank" rel="external">iSCSI Enterprise Target</a></li>
<li><a href="http://sourceforge.net/projects/intel-iscsi/" target="_blank" rel="external">intel iSCSI</a></li>
<li><a href="http://www.microsoft.com/windowsserver2003/technologies/storage/iscsi/default.mspx" target="_blank" rel="external">Microsoft iSCSI Initiator 2.0X</a></li>
<li><a href="http://linux-iscsi.sourceforge.net/" target="_blank" rel="external">linux-iscsi(project</a></li>
<li><a href="http://www.open-iscsi.org/" target="_blank" rel="external">Open iSCSI</a></li>
<li>Microsoft Storage 2003</li>
<li><a href="http://www.starwindsoftware.com/" target="_blank" rel="external">StarWind</a></li>
</ol>
<h3 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h3><ol>
<li><p>防火墙链接限制，外界无法访问Target服务器3260端口。<br> 请在防火墙上手动放开3260端口，或者有条件的话干脆关闭防火墙。<br> 更改防火墙配置并重启生效<br> vi /etc/sysconfig/iptables<br> server iptable restart  </p>
<p> service iptables stop<br> setenforce 0  </p>
</li>
<li><p>共享的路径都可以有哪些？<br> 在IET的技术文档中规定，以下几种路径是被支持的：  </p>
<pre><code>1)一个完整的 block 磁盘，比如/dev/sdb 。  
2)一个RAID设备或者是一个LVM.  
3)一个虚拟的镜像文件, 如dd使用创建.  
</code></pre></li>
<li><p>“iscsiadm:No portals found”.   </p>
<ul>
<li>可能服务没有启动：重启iscsid服务, <code>service iscsi start</code> </li>
<li>可能存储端没有允许当前ip访问：</li>
</ul>
</li>
</ol>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.cnblogs.com/yunnotes/archive/2013/04/19/3032488.html" target="_blank" rel="external">iSCSI学习总结</a></li>
<li><a href="http://tech.watchstor.com/storage-network-130569.htm" target="_blank" rel="external">★★★如何正确使用iSCSI Enterprise Target</a></li>
<li><a href="http://www.doc88.com/p-51666752050.html" target="_blank" rel="external">iSCSI协议解析★★★</a></li>
<li><a href="http://www.h3c.com.cn/Solution/Multimedia_Communicate/Video_Surveillance_Storage/How_Do_I_Do_It/White_Paper/201008/686814_30004_0.htm" target="_blank" rel="external">iSCSI技术白皮书★★★</a></li>
<li><a href="http://www.sansky.net/article/2007-12-03-iscsi-storage.html" target="_blank" rel="external">iSCSI存储技术全攻略</a></li>
<li><a href="http://blog.sina.com.cn/s/blog_5c0153620100g7e2.html" target="_blank" rel="external">Linux下iSCSI安装步骤</a></li>
<li><a href="http://kissthink.com/archive/4379.html" target="_blank" rel="external">ET - iSCSI Enterprise Target</a></li>
<li><a href="http://lynnkong.iteye.com/blog/1806470" target="_blank" rel="external">存储基础知识学习笔记</a></li>
<li><a href="http://storage.cnw.com.cn/storage-virtualization/htm2012/20121210_260295.shtml" target="_blank" rel="external">解析iSCSI存储系统的未来发展</a></li>
<li><a href="http://sunshyfangtian.blog.51cto.com/1405751/560162/" target="_blank" rel="external">CentOS5 iSCSI部署</a></li>
<li><a href="http://www.storage-conference.org/2003/papers/19-Meth-Design.pdf" target="_blank" rel="external">Design of the ISCSI Protocol</a></li>
<li><a href="http://pmghong.blog.163.com/blog/static/2146602802012111505853540/" target="_blank" rel="external">iSCSI 二 – 搭建基于iSCSI的IP SAN存储系统</a></li>
<li><a href="http://blog.csdn.net/do2jiang/article/details/5144706" target="_blank" rel="external">ISCSI Target的常用配置和常用操作-备忘</a></li>
<li><a href="http://blog.csdn.net/vah101/article/details/6300197" target="_blank" rel="external">Linux下应用tgtadm构建iSCSI Target–SAN</a></li>
<li><a href="http://www.2cto.com/os/201202/119963.html" target="_blank" rel="external">详解Linux下挂载和格式化虚拟磁盘</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/24/iscsi/" data-id="ciqqpe1pv009lnmpv48albos7" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/iscsi/">iscsi</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-how-to-learn-morse-code" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/24/how-to-learn-morse-code/" class="article-date">
  <time datetime="2014-06-23T16:00:00.000Z" itemprop="datePublished">2014-06-24</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/24/how-to-learn-morse-code/">How to Learn Morse Code</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p><img src="/assets/image/posts/Morse-code-tree.svg" alt="Morse code tree"></p>
<p><strong>From</strong> <a href="http://www.wikihow.com/Learn-Morse-Code" target="_blank" rel="external">http://www.wikihow.com/Learn-Morse-Code</a></p>
<p>The Morse Code was developed by Samuel F.B. Morse in 1844. Even after more than<br>160 years, it is still used today, especially by amateur radio operators. The<br>code can be sent quickly over the telegraph, and is also useful for emergency<br>signaling (SOS) with a radio, mirror, or flashlight, and even for people with<br>severe disabilities to communicate. In order to master Morse code, however, you<br>need to approach it like a new language.</p>
<h3 id="Step-1"><a href="#Step-1" class="headerlink" title="Step 1"></a>Step 1</h3><p>Listen carefully to slow morse code recordings. What you’re listening for is a<br>combination of dots and dashes (also referred to as dits and dahs). A dit is a<br>short beep, while a dah is a longer beep (three times longer). Every letter is<br>separated by a short pause, and every word is separated by a longer pause (three<br>times longer).</p>
<ul>
<li>You can search or shop for practice recordings, or use a shortwave receiver to<br>listen to the real thing. Free and inexpensive Morse training software is<br>available and usually better than the recordings, it can be set to change the<br>text randomly so it never gets “stale” and you can choose whatever learning<br>method works best for you. Never count dots and dashes, learn the sound of the<br>letter. If you are using Farnsworth, you set the spacing between letters slower<br>than the letter speed. Choose a letter speed a bit above your target code speed<br>and never lower the letter speed, only the letter spacing. This is the way to<br>learn Morse as a language, 15-25 words per minute or more. The following methods<br>are best used when you have no intention of using Morse above 5 words per minute,<br>they will require you to un learn the bad habits and start over.</li>
</ul>
<h3 id="Step-2"><a href="#Step-2" class="headerlink" title="Step 2"></a>Step 2</h3><p>Refer to a copy of the Morse Code alphabet (as seen at the bottom of the page).<br>You can use a basic chart such as the one shown at right (click to enlarge), or<br>you can use a more advanced chart which includes punctuation, abbreviated phrases,<br>prosigns and Q Codes.<a href="http://morsecode.scphillips.com/morse2.html" target="_blank" rel="external">1</a> Match up what you heard to the letters in the alphabet.<br>What does it say? Were you correct?</p>
<p>Some people find it easier to learn by writing down the letter with dots/periods<br>and dashes, and comparing it to a chart such as the one shown; others say this<br>creates an additional step that will only slow you down in learning Morse code.<br>Do whatever feels more comfortable for you. If you choose to avoid interpreting<br>written dots and dashes, you can use a pronunciation chart which lists the sounds<br>of the Morse Code signals, as if you were hearing them, rather than the dash and<br>dot symbols.<a href="http://morsecode.scphillips.com/morse.html" target="_blank" rel="external">2</a></p>
<h3 id="Step-3"><a href="#Step-3" class="headerlink" title="Step 3"></a>Step 3</h3><p>Sound it out. Practice translating basic words and sentences into Morse code. In<br>the beginning, you can write it down, then sound it out, but eventually you’ll<br>need to go straight to sounding it out. For example, the word “cat”. Write it down:</p>
<pre><code>-.-.   .-   -
</code></pre><p>then transmit the word (you can use the buttons on a mobile phone, or beep<br>vocally – the latter will probably help your mind pick up the code faster). To<br>pronounce morse code, dit is pronounced di with a short i sound and a silent t.<br>Dah is pronounced with a short a sound. So cat is pronounced dah-di-dah-di di-dah<br>dah. Once you feel comfortable with that, pick up a children’s book and try to<br>transmit the content in Morse code without writing anything down. Record yourself<br>and play it back later to see if you were correct.</p>
<ul>
<li>Be conscious of your spacing. Each letter needs to be separated by a space<br>that’s the same duration as a dah (three times the duration of a dit). Each word<br>needs to be separated by a space that lasts about seven times the duration of a<br>dit. The better your spacing, the easier your code will be to understand.</li>
</ul>
<h3 id="Step-4"><a href="#Step-4" class="headerlink" title="Step 4"></a>Step 4</h3><p>Memorize the easiest letters first.<a href="http://www.learnmorsecode.com/" target="_blank" rel="external">3</a> A single dah is a “T” and a single dit is<br>an “E”. Next, a dah-dah is an “M” and a dit-dit is an “I”. Memorize the letters<br>for 3 and 4 dits and dahs in a row. Once you’ve got those down, start memorizing<br>the combinations: dit-dah, dit-dah-dah, dit-dah-dah-dah, and so on. Leave the more<br>complex combinations for last. Fortunately, this includes some less commonly used<br>letters (like Q, Y, X, and V) so when you get to this point, focus on the more<br>commonly used letters first. Notice how E and T have the shortest symbols, and<br>how K, Z, Q, and X have long symbols. </p>
<h3 id="Step-5"><a href="#Step-5" class="headerlink" title="Step 5"></a>Step 5</h3><p>Make associations. For every letter, think of a memorable “sound alike”. Here’s<br>an example: The letter “C” is dah-dit-dah-dit (long short long short). Can you<br>think of a word that starts with that letter, and sounds like the Morse<br>pronunciation? How about catastrophic, which has an emphasis on the first and<br>third syllable, and begins with a “c”? Or how about dah-dit, which is Morse code<br>for “N”? How about nanny? This will be harder for words that end in several “dahs”<br>in a row, since many words in the English language alternate emphasis between<br>syllables, and usually do not end with an emphasis, but you could use sentences,<br>too. There are also existing Morse code mnemonics that have been around for many<br>years; you might be able to find them online, or purchase them.<a href="http://www.cq2k.com" target="_blank" rel="external">4</a></p>
<ul>
<li>If you’re a music lover, you can try associating Morse code pronunciations with<br>tunes or melodies that are familiar with you. For example, the distinctive<br>beginning of Beethoven’s Symphony No. 5 is short-short-short-long, or dit-dit-dit-dah,<br>which is the letter “V”, the roman numeral for “5” (as in Beethoven’s 5th Symphony),<br>and is rather appropriate for such a “victorious” tune, don’t you think? During<br>WW2, BBC broadcasters used this four-note melody to start off its radio broadcasts<br>because of its association with the word “victory”! <a href="http://en.wikipedia.org/wiki/Symphony_No._5_(Beethoven)" target="_blank" rel="external">5</a></li>
</ul>
<h3 id="Step-6"><a href="#Step-6" class="headerlink" title="Step 6"></a>Step 6</h3><p>Have fun with it. Want to get your friends into it? Learn how to blink code. That<br>way, you can give an SOS blink when your friend just introduced you to a rather<br>unpleasant blind date, for instance. Use written Morse code to write secret notes,<br>or keep a diary in Morse, or tell dirty jokes without anyone knowing. Give someone<br>a Morse code greeting card. Say “I love you” in Morse code (how romantic!).<br>Whatever floats your boat, find a way to do it in Morse code, and you’ll learn<br>it much faster. </p>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://morsecode.scphillips.com/morse2.html" target="_blank" rel="external">1</a></li>
<li><a href="http://morsecode.scphillips.com/morse.html" target="_blank" rel="external">2</a></li>
<li><a href="http://www.learnmorsecode.com/" target="_blank" rel="external">3</a></li>
<li><a href="http://www.cq2k.com" target="_blank" rel="external">4</a></li>
<li><a href="http://en.wikipedia.org/wiki/Symphony_No._5_(Beethoven)" target="_blank" rel="external">5</a></li>
</ul>
<h3 id="Other"><a href="#Other" class="headerlink" title="Other"></a>Other</h3><ul>
<li><a href="http://www.onlineconversion.com/morse_code.htm" target="_blank" rel="external">online translate</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/24/how-to-learn-morse-code/" data-id="ciqqpe1ps009inmpv76u3y0nb" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-iscsi-enterprise-target" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/23/iscsi-enterprise-target/" class="article-date">
  <time datetime="2014-06-22T16:00:00.000Z" itemprop="datePublished">2014-06-23</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/storage/">storage</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/23/iscsi-enterprise-target/">iSCSI Enterprise Target</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h2 id="iSCSI-Enterprise-Target"><a href="#iSCSI-Enterprise-Target" class="headerlink" title="iSCSI Enterprise Target"></a>iSCSI Enterprise Target</h2><h3 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h3><pre><code>SCSI     : small computer system interface
iSCSI    : Internet SCSI
Initiator:
Target   :
</code></pre><h3 id="component-of-protocol"><a href="#component-of-protocol" class="headerlink" title="component of protocol"></a>component of protocol</h3><ol>
<li><p>Communication</p>
<ul>
<li>connect </li>
<li>session<ul>
<li>login</li>
<li>full feature</li>
</ul>
</li>
<li>pdu</li>
</ul>
</li>
<li><p>Naming and addressing</p>
<ul>
<li>iqn.iSCSI </li>
<li>eui.IEEEEUI264</li>
</ul>
</li>
<li><p>Error Handle</p>
<ul>
<li>misclassification</li>
<li>Recovery mechanism</li>
</ul>
</li>
<li><p>Security</p>
<ul>
<li>Authentication<ul>
<li>CHAP</li>
</ul>
</li>
</ul>
</li>
</ol>
<h3 id="Code-flow"><a href="#Code-flow" class="headerlink" title="Code flow"></a>Code flow</h3><ol>
<li>Login phase</li>
<li>Data execute of text phase</li>
<li>logout pahse<ul>
<li>Report LUNS(0xa0)-&gt; </li>
<li>Inquiry(0x12) -&gt; </li>
<li>Read Capacity(10) (0x25) -&gt; </li>
<li>Read(10)(0x28) -&gt; </li>
<li>Mode Sense(6)(0x1a)</li>
</ul>
</li>
</ol>
<h3 id="Source-code"><a href="#Source-code" class="headerlink" title="Source code"></a>Source code</h3><ul>
<li><p>source:</p>
</li>
<li><p>build:</p>
</li>
<li><p>patch</p>
<pre><code>tar xvf iscsitarget-1.4.20.tar.gz
cd iscsitarget-1.4.20
patch -p1 &lt; ../iscsitarget-1.4.20_patch/compat-2.6.32.patch
patch -p1 &lt; ../iscsitarget-1.4.20_patch/iscsitarget-xxx-1.4.20_for_centos_6_2.patch
patch -p1 &lt; ../iscsitarget-1.4.20_patch/iscsi_conn_close_raid_failed.patch
patch -p1 &lt; ../iscsitarget-1.4.20_patch/iscsi_load_balance_bug_fix.patch
patch -p1 &lt; ../iscsitarget-1.4.20_patch/iscsi_flow_control.patch
patch -p1 &lt; ../iscsitarget-1.4.20_patch/iscsi_disable_sync_cache.patch
</code></pre></li>
</ul>
<h3 id="Analysis"><a href="#Analysis" class="headerlink" title="Analysis"></a>Analysis</h3><h4 id="Kernel-module"><a href="#Kernel-module" class="headerlink" title="Kernel module"></a>Kernel module</h4><p>iscsi_trgt.ko</p>
<p>most of the work were done in kernel, such as data send and recv,<br>and the user mode do session create, author and login.</p>
<p>sub-module list as below:</p>
<ul>
<li>Files<ul>
<li>iotype.c</li>
<li>nthread.c<ul>
<li>listen iSCSI request from iSCSI Initiator</li>
<li>receive iSCSI request</li>
<li>initialize iSCSI Command structure and LUN parameters</li>
<li>allocate data cache (struct tio)</li>
<li>handle r2t data</li>
</ul>
</li>
<li>wthread.c<ul>
<li>communicate with nthread</li>
<li>handle iSCSI command from nthread</li>
<li>command can be divided into two types: related , not related </li>
<li>execute callback function</li>
</ul>
</li>
<li>response<ul>
<li>dispatch by wthread</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4 id="User-module"><a href="#User-module" class="headerlink" title="User module"></a>User module</h4><p>ietd daemon, manager tool for IET, function description:</p>
<ul>
<li>configuration, such as port, uid, gid and so on.</li>
<li>read config info from /etc/ietd.conf, and send to kernel module </li>
</ul>
<h4 id="iSCSI-mod"><a href="#iSCSI-mod" class="headerlink" title="iSCSI mod"></a>iSCSI mod</h4><ul>
<li>blockio<br>translate network data to struct tio, then handle by<br>blockio_make_request from block_io.c, submit_bio to<br>common layer after generate bio </li>
<li>fileio<br>still use VFS, and do system call read/write to operate data.</li>
<li>functional description  </li>
</ul>
<h3 id="How-IET-add-lun"><a href="#How-IET-add-lun" class="headerlink" title="How IET add lun?"></a>How IET add lun?</h3><p>加入volume有两种方式:</p>
<ol>
<li>通过配置文件ietd.conf</li>
<li>通过ietdadm命令，使用<code>--op new --tid=[id] --lun=[lun] --params Path=[path]</code>参数</li>
</ol>
<p>第一种方式的流程如下: (用户态)<br><code>plain_init() -&gt; __plain_lunit_create -&gt; ki-&gt;lunit_create -&gt; iscsi_lunit_create -&gt; ioctl(ctrl_fd, ADD_VOLUME, &amp;info)</code></p>
<p>第二种方式的流程如下: (用户态)<br><code>ietadm_request_exec -&gt; cops-&gt;lunit_add() -&gt; plain_lunit_create() -&gt; __plain_lunit_create</code>  后面同上</p>
<p>核态部分相同:  </p>
<ul>
<li><code>config.c:add_volume -&gt; volume.c:volume_add -&gt; volume.c:parse_volume_params</code> </li>
<li><code>volume.c:parse_volume_params</code> 函数检查发现是opt_iomode类型，  </li>
</ul>
<h3 id="Type-IOMode-and-Sector-Setting"><a href="#Type-IOMode-and-Sector-Setting" class="headerlink" title="Type, IOMode and Sector Setting"></a>Type, IOMode and Sector Setting</h3><p>Run by the ietadm command as below:  </p>
<ul>
<li><code>ietadm --op new --tid=%d --lun=%d --params Path=/dev/%s/%s,IOMode=%s,Sector=%s,Type=%s</code><ul>
<li><strong>IOMode</strong>: wb or wt or ro</li>
<li><strong>Sector</strong>: 512 or 4096</li>
<li><strong>Type</strong>: fileio or blockio</li>
</ul>
</li>
</ul>
<p>Function calling:</p>
<ul>
<li><code>ietadm.c: main() -&gt; lunit_handle() -&gt; ietd_request() -&gt; ietd_connect(),ietd_request_send(),ietd_response_recv()</code><ul>
<li><code>ietd_connect() -&gt; socket(AF_LOCAL, SOCK_STREAM, 0), connect()</code></li>
<li><code>ietd_request_send() -&gt; write(fd, req, sizeof(*req))</code></li>
<li><code>ietd_request_recv() -&gt; readv(), read()</code></li>
</ul>
</li>
<li><code>ietd.c: main() -&gt; message.c: ietadm_request_listen() -&gt;</code><ul>
<li><code>ietadm_request_listen() -&gt; socket(AF_LOCAL, SOCK_STREAM, 0), bind(), listen()</code></li>
</ul>
</li>
</ul>
<p>Code analysis:  </p>
<ul>
<li><code>ietadm --op new --tid= --lun= --params</code><ul>
<li>调用 ietadm.c:lunit_handle函数 -&gt;ietd_request函数 -&gt;ietd_request_send函数</li>
<li>ietd.c的event_loop函数监听到有消息，执行message.c:ietadm_request_handle函数 </li>
<li>message.c:ietadm_request_handle函数 -&gt; ietadm_request_exec函数<br>类型为C_LUNIT_NEW, 执行cops-&gt;lunit_add  </li>
<li><code>plain.c:plain_lunit_create -&gt;__plain_lunit_create -&gt; ki-&gt;lunit_create</code> </li>
<li><code>ctldev.c:iscsi_lunit_create -&gt; ioctl(ctrl_fd, ADD_VOLUME, &amp;info)</code> </li>
<li><code>config.c:add_volume -&gt; volume.c:volume_add -&gt; volume.c:parse_volume_params</code> </li>
<li><code>volume.c:parse_volume_params</code> 函数检查发现是opt_iomode类型，<br>如果是ro类型执行SetLUReadonly(volume);<br>如果是wb类型执行SetLUWCache(volume);<br>如果是wt类型则类型不可用  </li>
<li>SetLUReadonly和SetLUWCache都在iscsi.h中定义，都只是修改struct iet_volume结构体中的flags的值。</li>
<li>另外块大小blocksize保存在结构体struct iet_volume的blk_shift中,且块大小必须是<br>2的幂次方，大于等于512，小于4096. 注意保存的是2的幂的次数，即如果是1024，则blk_shift是10</li>
<li>如果fileio,进入file-io.c:fileio_attach函数, 调用parse_fileio_params, 这里会忽略好些参数的值.<br>之用path参数会有处理。  </li>
<li>如果blockio,进入block-io.c:blockio_attach函数, 调用parse_blockio_params, 这里会忽略好些参数的值.<br>之用path参数会有处理。  </li>
<li>file-io.c 和 block-io.c要好好看看，这个逻辑卷到底怎么创建的.</li>
</ul>
</li>
</ul>
<p>Summary:</p>
<ul>
<li><strong>总结:</strong><ul>
<li>Type: <strong>如果是fileio那么读写操作通过vfs请求完成，如果是blockio则读写操作直接构造bio请求</strong></li>
<li>IOMode: <strong>如果是wb,    </strong></li>
<li>Sector</li>
</ul>
</li>
</ul>
<h3 id="Other-iSCSI-implement"><a href="#Other-iSCSI-implement" class="headerlink" title="Other iSCSI implement"></a>Other iSCSI implement</h3><ul>
<li>open-iscsi, <a href="http://open-iscsi.org" target="_blank" rel="external">homepage</a>,<br><a href="https://github.com/mikechristie/open-iscsi" target="_blank" rel="external">source</a>,<br><a href="http://blog.chinaunix.net/uid-14518381-id-3237994.html" target="_blank" rel="external">code analysis</a></li>
</ul>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/ISCSI" target="_blank" rel="external">ISCSI Wikipedia</a></li>
<li><a href="http://iscsitarget.sourceforge.net" target="_blank" rel="external">iSCSITarget</a></li>
<li><a href="http://sourceforge.net/projects/iscsitarget/files/iscsitarget/" target="_blank" rel="external">iSCSITarget download</a></li>
<li><a href="http://blog.csdn.net/kidd_3/article/details/7670415" target="_blank" rel="external">iSCSI Enterprise Target的架构分析</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/23/iscsi-enterprise-target/" data-id="ciqqpe1pp009fnmpvul6cei71" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/iscsi/">iscsi</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-software-agent" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/21/software-agent/" class="article-date">
  <time datetime="2014-06-20T16:00:00.000Z" itemprop="datePublished">2014-06-21</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/others/">others</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/21/software-agent/">software agent</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Concepts"><a href="#Concepts" class="headerlink" title="Concepts"></a>Concepts</h3><p>M.Minsky曾经在1994年就指出，“Agent是一些具有特别技能的个体”。针对计算机系统，<br>Agent是指“当使用者向机器说明完成某些任务，而无需了解机器自身是如何工作，即将其处理为黑箱时，就称其为Agent。”<br>目前学术界对其尚无一个公认的定义，国内多将其译为智能代理。</p>
<h3 id="Application"><a href="#Application" class="headerlink" title="Application"></a>Application</h3><h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://en.wikipedia.org/wiki/Software_agent" target="_blank" rel="external">software agent</a></li>
<li><a href="http://en.wikipedia.org/wiki/Agent_Communications_Language" target="_blank" rel="external">ACL</a></li>
<li><a href="http://en.wikipedia.org/wiki/Agent-oriented_programming" target="_blank" rel="external">AOP: Agent oriented programming</a></li>
<li><a href="http://baike.baidu.com/link?url=MEUtNP6k1W7gXK2LcHdKX4O46UT4kAwv4Bje2hTKHAQSitqlCvbSAjK3z_iex6GdE8jRgcQc91kTPphXPEecIK" target="_blank" rel="external">Agent技术</a></li>
<li><a href="http://en.wikipedia.org/wiki/Java_Agent_Development_Framework" target="_blank" rel="external">JADE</a></li>
<li><a href="http://www.agentbuilder.com/index.html" target="_blank" rel="external">agentbuilder</a></li>
<li><a href="http://www.agentbuilder.com/Documentation/whyAgents.html" target="_blank" rel="external">Why, When, and Where to Use Software Agents</a> </li>
<li><a href="http://ootips.org/agent-orientation.html" target="_blank" rel="external">Agent Oriented Programming</a></li>
<li><a href="http://en.wikipedia.org/wiki/FIPA" target="_blank" rel="external">FIPA</a></li>
<li><a href="http://stackoverflow.com/questions/5216865/agent-oriented-design-in-the-real-world" target="_blank" rel="external">Agent Oriented Design in the real world?</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/21/software-agent/" data-id="ciqqpe1pl009cnmpvwhl2tetv" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/others/">others</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-use-moosefs" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/17/use-moosefs/" class="article-date">
  <time datetime="2014-06-16T16:00:00.000Z" itemprop="datePublished">2014-06-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/17/use-moosefs/">use moosefs</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Master-server-installation"><a href="#Master-server-installation" class="headerlink" title="Master server installation"></a>Master server installation</h3><ul>
<li><p><strong>Installation</strong></p>
<pre><code>groupadd mfs
useradd -g mfs mfs
cd /usr/src
tar -zxvf mfs-1.6.15.tar.gz
cd mfs-1.6.15
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib 
--with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver 
--disable-mfsmount
make
make install 
</code></pre></li>
<li><p><strong>Configuration</strong></p>
</li>
</ul>
<ol>
<li><p>Copy config</p>
<pre><code>cd /etc
cp mfsmaster.cfg.dist mfsmaster.cfg
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
cp mfsexports.cfg.dist mfsexports.cfg

# modify mfsexports.cfg 
# 192.168.2.0/24 / rw,alldirs,maproot=0 
</code></pre></li>
<li><p>Copy meta data file</p>
<pre><code>cd /var/lib/mfs
cp metadata.mfs.empty metadata.mfs
</code></pre></li>
<li><p>Config host name</p>
<pre><code>echo 192.168.1.1 mfsmaster&gt;&gt; /etc/hosts
</code></pre></li>
</ol>
<ul>
<li><p><strong>Run server</strong></p>
<pre><code>/usr/sbin/mfsmaster start

# Run CGI monitor server, and view info under &lt;http://192.168.1.1:9425&gt;
/usr/sbin/mfscgiserv 
</code></pre></li>
</ul>
<h3 id="Install-Backup-Server-metalogger"><a href="#Install-Backup-Server-metalogger" class="headerlink" title="Install Backup Server (metalogger)"></a>Install Backup Server (metalogger)</h3><p>Metalogger installation is very similar to that of the master server.<br>We issue the following commands:</p>
<pre><code>groupadd mfs
useradd -g mfs mfs
cd /usr/src
tar -zxvf mfs-1.6.15.tar.gz
cd mfs-1.6.15
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib 
--with-default-user=mfs --with-default-group=mfs --disable-mfschunkserver 
--disable-mfsmount
make
make install

cd /etc
cp mfsmetalogger.cfg.dist mfsmetalogger.cfg
</code></pre><p>Similarly, in /etc/hosts we add:</p>
<pre><code>192.168.1.1 mfsmaster
</code></pre><p>Now we are ready to start the backup server process :</p>
<pre><code>/usr/sbin/mfsmetalogger start
</code></pre><p>In a production environment you should set up automatic start of mfsmetalogger. </p>
<h3 id="Chunk-servers-installation"><a href="#Chunk-servers-installation" class="headerlink" title="Chunk servers installation"></a>Chunk servers installation</h3><p>We issue the following commands on the machines which are to be chunks servers:</p>
<pre><code>groupadd mfs
useradd -g mfs mfs
cd /usr/src
tar -zxvf mfs-1.6.15.tar.gz
cd mfs-1.6.15
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/lib 
--with-default-user=mfs --with-default-group=mfs --disable-mfsmaster
make
make install
</code></pre><p>Now we similarly prepare configuration files of the chunk server:</p>
<pre><code>cd /etc/
cp mfschunkserver.cfg.dist mfschunkserver.cfg
cp mfshdd.cfg.dist mfshdd.cfg 
</code></pre><p>use <code>/mnt/mfschunks1</code> and <code>/mnt/mfschunks2</code> locations , so we add these two<br>lines to mfshdd.cfg file:</p>
<pre><code>/mnt/mfschunks1
/mnt/mfschunks2
</code></pre><p>Create a <code>.lock</code> file to make user <code>mfs</code> has rights to write the mounted partitions.</p>
<pre><code>chown -R mfs:mfs /mnt/mfschunks1
chown -R mfs:mfs /mnt/mfschunks2 
</code></pre><p>Similarly we add the following line in <code>/etc/hosts</code> file:</p>
<pre><code>192.168.1.1 mfsmaster
</code></pre><p>Now we are ready to start the chunk server:</p>
<pre><code>/usr/sbin/mfschunkserver start 
</code></pre><h3 id="Users’-computers-installation"><a href="#Users’-computers-installation" class="headerlink" title="Users’ computers installation"></a>Users’ computers installation</h3><p>Install FUSE</p>
<pre><code>cd /usr/src
tar -zxvf fuse-2.8.3.tar.gz
cd fuse-2.8.3
./configure
make
make install
</code></pre><p>In order to install mfsmount package we do the following steps:</p>
<pre><code>tar -zxvf mfs-1.6.15.tar.gz
cd mfs-1.6.15
./configure --prefix=/usr --sysconfdir=/etc
--localstatedir=/var/lib --with-default-user=mfs
--with-default-group=mfs --disable-mfsmaster
--disable-mfschunkserver
make
make install
</code></pre><p>In a /etc/hosts file we add this line:</p>
<pre><code>192.168.1.1 mfsmaster
</code></pre><p>Let’s assume that we will mount the system in a /mnt/mfs folder on a client’s<br>machine. We issue the following commands:</p>
<pre><code>mkdir -p /mnt/mfs
/usr/bin/mfsmount /mnt/mfs -H mfsmaster
</code></pre><p>Now after issuing the <code>df -h | grep mfs</code> command we should get information<br>similar to this:</p>
<pre><code>/storage/mfschunks/mfschunks1
    2.0G 69M 1.9G 4% /mnt/mfschunks1
/storage/mfschunks/mfschunks2
    2.0G 69M 1.9G 4% /mnt/mfschunks2
mfs#mfsmaster:9421 3.2G 0 3.2G 0% /mnt/mfs 
</code></pre><h3 id="Installing-MooseFS-on-one-server"><a href="#Installing-MooseFS-on-one-server" class="headerlink" title="Installing MooseFS on one server"></a>Installing MooseFS on one server</h3><ul>
<li>Install <code>FUSE</code></li>
<li>Install <code>Moosefs</code></li>
</ul>
<h3 id="Basic-MooseFS-Usage"><a href="#Basic-MooseFS-Usage" class="headerlink" title="Basic MooseFS Usage"></a>Basic MooseFS Usage</h3><p>The number of copies for the folder is set with the <code>mfssetgoal –r</code> command: </p>
<pre><code>mfssetgoal -r 1 /mnt/mfs/folder1
/mnt/mfs/folder1:
inodes with goal changed: 0
inodes with goal not changed: 1
inodes with permission denied: 0
mfssetgoal -r 2 /mnt/mfs/folder2
/mnt/mfs/folder2:
inodes with goal changed: 0
inodes with goal not changed: 1
inodes with permission denied: 0 
</code></pre><p>The command <code>mfscheckfile</code> is used for checking in how many copies the given<br>file is stored. </p>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-v.1.1.pdf" target="_blank" rel="external">http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-v.1.1.pdf</a></li>
<li><a href="http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-cn-v.1.1.pdf" target="_blank" rel="external">http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-cn-v.1.1.pdf</a></li>
<li><a href="http://sourceforge.net/projects/moosefs/files/moosefs/" target="_blank" rel="external">http://sourceforge.net/projects/moosefs/files/moosefs/</a></li>
<li><a href="http://bbs.chinaunix.net/thread-1644309-1-1.html" target="_blank" rel="external">http://bbs.chinaunix.net/thread-1644309-1-1.html</a></li>
<li><a href="http://bbs.chinaunix.net/thread-1643863-1-1.html" target="_blank" rel="external">http://bbs.chinaunix.net/thread-1643863-1-1.html</a></li>
<li><a href="http://sery.blog.51cto.com/10037/263515" target="_blank" rel="external">http://sery.blog.51cto.com/10037/263515</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/17/use-moosefs/" data-id="ciqqpe1pi0099nmpv6uro940d" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/filesystem/">filesystem</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-moosefs-source-code-analysis" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/17/moosefs-source-code-analysis/" class="article-date">
  <time datetime="2014-06-16T16:00:00.000Z" itemprop="datePublished">2014-06-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/source/">source</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/17/moosefs-source-code-analysis/">moosefs source code analysis</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="mfs-1-5-9"><a href="#mfs-1-5-9" class="headerlink" title="mfs-1.5.9"></a>mfs-1.5.9</h3><ol>
<li><p>Files</p>
<p> main.c —&gt; Init,<br> init.c —&gt; defined a <code>RunTab</code>, use for mainloop<br> changelog.c  changelog_init change log<br> random.c rndinit  random generator<br> matocsserv.c matocsserv_init  communication with chunkserver<br> matocuserv.c matocuserv_init  communication with customer<br> filesystem.c fs_init  file system manager<br> stats.c stats_init  statistics module</p>
<p> [dennis@localhost mfs-1.5.9]$ ls<br> aclocal.m4    config.sub    COPYING  INSTALL      Makefile.in<br> config.guess  configure     depcomp  install-sh   mfschunkserver<br> config.h.in   configure.ac  doc      Makefile.am  MFSCommunication.h<br> mfsdata       mfsmount      README   mfsmaster    missing mfsmetarestore<br> NEWS</p>
</li>
<li><p>TODO</p>
</li>
</ol>
<h4 id="master-server"><a href="#master-server" class="headerlink" title="master server"></a>master server</h4><ol>
<li><p>Files</p>
<p> [dennis@localhost mfs-1.5.9]$ ls mfsmaster/<br> cfg.c        changelog.h  filesystem.h  lempelziv.h  Makefile.am<br> matocsserv.h random.c     sockets.h     cfg.h        chunks.c<br> datapack.h   init.h       main.c        Makefile.in   matocuserv.c<br> changelog.c  chunks.h     filesystem.c  lempelziv.c   main.h<br> matocsserv.c  matocuserv.h  sockets.c  stats.h        random.h   stats.c</p>
</li>
</ol>
<h4 id="chunk-server"><a href="#chunk-server" class="headerlink" title="chunk  server"></a>chunk  server</h4><ol>
<li>TODO</li>
</ol>
<h4 id="client"><a href="#client" class="headerlink" title="client"></a>client</h4><ol>
<li>TODO</li>
</ol>
<h3 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h3><ul>
<li><a href="http://www.moosefs.org/download.html" target="_blank" rel="external">MooseFS HomePage</a></li>
<li><a href="http://sourceforge.net/projects/moosefs/" target="_blank" rel="external">http://sourceforge.net/projects/moosefs/</a></li>
<li><a href="http://sourceforge.net/projects/moosefs/files/moosefs/" target="_blank" rel="external">http://sourceforge.net/projects/moosefs/files/moosefs/</a></li>
<li><a href="http://www.cnblogs.com/JeffreySun/archive/2011/04/03/2004255.html" target="_blank" rel="external">MooseFS introduce</a></li>
<li><a href="http://www.cnblogs.com/JeffreySun/archive/2011/04/03/2004259.html" target="_blank" rel="external">mfsmount module</a></li>
<li><a href="http://www.cnblogs.com/JeffreySun/archive/2011/04/03/2004260.html" target="_blank" rel="external">mfsmaster module</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/17/moosefs-source-code-analysis/" data-id="ciqqpe1pd0093nmpvgl3ytq3m" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/filesystem/">filesystem</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-sms-develop" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/17/sms-develop/" class="article-date">
  <time datetime="2014-06-16T16:00:00.000Z" itemprop="datePublished">2014-06-17</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/17/sms-develop/">sms develop</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="Introduce"><a href="#Introduce" class="headerlink" title="Introduce"></a>Introduce</h4><ol>
<li><p>Different between RS232 and USB interface<br> For RS232, use serial operation directory, not need driver.<br> For USB, should intall driver.</p>
</li>
<li><p>OS support<br> Both windows and Linux will be supported, if the device support RS232, and<br> most of it support AT command, customer develop application with AT mostly.</p>
</li>
</ol>
<h4 id="Installation"><a href="#Installation" class="headerlink" title="Installation"></a>Installation</h4><ol>
<li>Minicom</li>
</ol>
<p>Ref:  </p>
<ul>
<li><a href="http://www.thegeekstuff.com/2013/05/modem-at-command/" target="_blank" rel="external">http://www.thegeekstuff.com/2013/05/modem-at-command/</a>  </li>
<li><a href="http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html" target="_blank" rel="external">http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html</a>  </li>
</ul>
<ol>
<li>Gnokii</li>
</ol>
<h4 id="Issue"><a href="#Issue" class="headerlink" title="Issue"></a>Issue</h4><p>minicom, not response for input<br>Serial port setup –&gt;Hardware Flow Contorl : NO<br>Local on/off  </p>
<p><a href="http://blog.sina.com.cn/s/blog_5d0e8d0d01015svy.html" target="_blank" rel="external">http://blog.sina.com.cn/s/blog_5d0e8d0d01015svy.html</a></p>
<h4 id="AT"><a href="#AT" class="headerlink" title="AT"></a>AT</h4><ul>
<li><p>get SIM ID</p>
<p>  at+ccid</p>
</li>
<li><p>get Chip Model</p>
<p>  ati3</p>
<p>  at+cgmr</p>
</li>
<li><p>get signal strength<br>normal : 16~31,<br>SMS err: <16 or="">31(display 99)</16></p>
<p>  at+csq</p>
</li>
<li><p>get baud rate</p>
<p>  at+ipr?</p>
</li>
<li><p>set baud rate (after set, need to re-connect)</p>
<p>  at+ipr=115200</p>
</li>
<li><p>save configuration</p>
<p>  at&amp;w</p>
</li>
<li><p>set SMS format</p>
<p>  at+cmgf=1</p>
</li>
<li><p>send SMS, success if return “+CMGS: “</p>
<p>  at+cmgs=137<strong>**</strong></p>
<blockquote>
<p>Hi, this is a SMS test</p>
</blockquote>
</li>
<li><p>read SMS, 4 is the position of SMS</p>
<p>  at+cmgr=4</p>
</li>
<li><p>get number of SMS center</p>
<p>  at+csca?</p>
</li>
<li><p>calling</p>
<p>  atd137<strong><em>**</em></strong>;</p>
</li>
<li><p>hand up</p>
<p>  ath</p>
</li>
<li><p>check state of SMS module</p>
<p>  at+cfun?</p>
</li>
<li><p>reboot SMS module</p>
<p>  at+cfun=0<br>  OK<br>  at+cfun=1<br>  OK</p>
</li>
<li><p>get IMEI code</p>
<p>  at+wmsn or at+cgsn</p>
</li>
<li><p>Full view</p>
<pre><code>at+ccid
+CCID: &quot;898600p1011130234927&quot;

OK
ati3
657e09gg.Q24PL002 1961548 103107 17:56

OK
at+cgmr
657e09gg.Q24PL002 1961548 103107 17:56

OK
at+csq
+CSQ: 25,0

OK
at+ipr?
+IPR: 115200

OK
at+ipr=9600
OK

at
OK
at&amp;w
OK

at+csq
+CSQ: 25,99

OK
at+cmgf=1
OK
at+cmgs=13707070909
&gt; Hi, this is SMS test.
+CMGS: 201

OK
</code></pre></li>
</ul>
<p>Ref <a href="http://www.sendsms.cn/download/js1.pdf" target="_blank" rel="external">http://www.sendsms.cn/download/js1.pdf</a></p>
<h4 id="Features"><a href="#Features" class="headerlink" title="Features"></a>Features</h4><ol>
<li>auto detect device by baut-rate </li>
<li>simple interface<br> 1). send message<br> 2). recv message</li>
</ol>
<h4 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h4><ol>
<li>Fail to find device</li>
<li>Fail to send message<br>there are many reasons to cause this, list the main reasons as below:<br>1). device error<br>1). baut-rate error<br>1). signal too weak</li>
</ol>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference"></a>Reference</h4><ul>
<li><a href="http://bbs.chinaunix.net/thread-1793815-1-1.html" target="_blank" rel="external">http://bbs.chinaunix.net/thread-1793815-1-1.html</a></li>
<li><a href="http://blog.csdn.net/lyserver/article/details/3007090" target="_blank" rel="external">http://blog.csdn.net/lyserver/article/details/3007090</a></li>
<li><a href="http://blog.chinaunix.net/uid-27717657-id-3378194.html" target="_blank" rel="external">http://blog.chinaunix.net/uid-27717657-id-3378194.html</a></li>
<li><a href="http://www.eeworm.com/dl/693/280937.html" target="_blank" rel="external">http://www.eeworm.com/dl/693/280937.html</a></li>
<li><a href="http://download.csdn.net/detail/zhaori/7511175" target="_blank" rel="external">http://download.csdn.net/detail/zhaori/7511175</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/17/sms-develop/" data-id="ciqqpe1pg0096nmpv7fkt2rkw" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/sms/">sms</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-use-protobuf" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/07/use-protobuf/" class="article-date">
  <time datetime="2014-06-06T16:00:00.000Z" itemprop="datePublished">2014-06-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/07/use-protobuf/">use protobuf</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h4 id="checkout-protobuf"><a href="#checkout-protobuf" class="headerlink" title="checkout protobuf"></a>checkout protobuf</h4><pre><code>svn checkout http://protobuf.googlecode.com/svn/trunk protobuf
</code></pre><h4 id="compile-install"><a href="#compile-install" class="headerlink" title="compile, install"></a>compile, install</h4><pre><code>[dennis@localhost protobuf]$ cd protobuf
[dennis@localhost protobuf]$ sh autogen.sh 
[dennis@localhost protobuf]$ ./configure
[dennis@localhost protobuf]$ make check 
[dennis@localhost protobuf]$ make install

[dennis@localhost protobuf]$ protoc --version
libprotoc 2.5.1
</code></pre><h4 id="write-sample-code"><a href="#write-sample-code" class="headerlink" title="write sample code"></a>write sample code</h4><pre><code>[dennis@localhost protobuf]$ mkdir ../google-code-sample
[dennis@localhost protobuf]$ cd ../google-code-sample
[dennis@localhost google-code-sample]$ vim addressbook.proto
[dennis@localhost google-code-sample]$ vim pb_write.cc
[dennis@localhost google-code-sample]$ vim pb_read.cc
[dennis@localhost google-code-sample]$ vim Makefile
</code></pre><h4 id="cat-addressbook-proto"><a href="#cat-addressbook-proto" class="headerlink" title="cat addressbook.proto"></a>cat addressbook.proto</h4><pre><code>package tutorial;

message Person {
  required string name = 1;
  required int32 id = 2;
  optional string email = 3;

  enum PhoneType {
    MOBILE = 0;
    HOME = 1;
    WORK = 2;
  }

  message PhoneNumber {
    required string number = 1;
    optional PhoneType type = 2 [default = HOME];
  }

  repeated PhoneNumber phone = 4;
}

message AddressBook {
  repeated Person person = 1;
}
</code></pre><h4 id="cat-pb-write-cc"><a href="#cat-pb-write-cc" class="headerlink" title="cat pb_write.cc"></a>cat pb_write.cc</h4><pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &quot;addressbook.pb.h&quot;
using namespace std;

// This function fills in a Person message based on user input.
void PromptForAddress(tutorial::Person* person) {
  cout &lt;&lt; &quot;Enter person ID number: &quot;;
  int id;
  cin &gt;&gt; id;
  person-&gt;set_id(id);
  cin.ignore(256, &apos;\n&apos;);

  cout &lt;&lt; &quot;Enter name: &quot;;
  getline(cin, *person-&gt;mutable_name());

  cout &lt;&lt; &quot;Enter email address (blank for none): &quot;;
  string email;
  getline(cin, email);
  if (!email.empty()) {
    person-&gt;set_email(email);
  }

  while (true) {
    cout &lt;&lt; &quot;Enter a phone number (or leave blank to finish): &quot;;
    string number;
    getline(cin, number);
    if (number.empty()) {
      break;
    }

    tutorial::Person::PhoneNumber* phone_number = person-&gt;add_phone();
    phone_number-&gt;set_number(number);

    cout &lt;&lt; &quot;Is this a mobile, home, or work phone? &quot;;
    string type;
    getline(cin, type);
    if (type == &quot;mobile&quot;) {
      phone_number-&gt;set_type(tutorial::Person::MOBILE);
    } else if (type == &quot;home&quot;) {
      phone_number-&gt;set_type(tutorial::Person::HOME);
    } else if (type == &quot;work&quot;) {
      phone_number-&gt;set_type(tutorial::Person::WORK);
    } else {
      cout &lt;&lt; &quot;Unknown phone type.  Using default.&quot; &lt;&lt; endl;
    }
  }
}

// Main function:  Reads the entire address book from a file,
//   adds one person based on user input, then writes it back out to the same
//   file.
int main(int argc, char* argv[]) {
  // Verify that the version of the library that we linked against is
  // compatible with the version of the headers we compiled against.
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  if (argc != 2) {
    cerr &lt;&lt; &quot;Usage:  &quot; &lt;&lt; argv[0] &lt;&lt; &quot; ADDRESS_BOOK_FILE&quot; &lt;&lt; endl;
    return -1;
  }

  tutorial::AddressBook address_book;

  {
    // Read the existing address book.
    fstream input(argv[1], ios::in | ios::binary);
    if (!input) {
      cout &lt;&lt; argv[1] &lt;&lt; &quot;: File not found.  Creating a new file.&quot; &lt;&lt; endl;
    } else if (!address_book.ParseFromIstream(&amp;input)) {
      cerr &lt;&lt; &quot;Failed to parse address book.&quot; &lt;&lt; endl;
      return -1;
    }
  }

  // Add an address.
  PromptForAddress(address_book.add_person());

  {
    // Write the new address book back to disk.
    fstream output(argv[1], ios::out | ios::trunc | ios::binary);
    if (!address_book.SerializeToOstream(&amp;output)) {
      cerr &lt;&lt; &quot;Failed to write address book.&quot; &lt;&lt; endl;
      return -1;
    }
  }

  // Optional:  Delete all global objects allocated by libprotobuf.
  google::protobuf::ShutdownProtobufLibrary();

  return 0;
}
</code></pre><h4 id="cat-pb-read-cc"><a href="#cat-pb-read-cc" class="headerlink" title="cat pb_read.cc"></a>cat pb_read.cc</h4><pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &quot;addressbook.pb.h&quot;
using namespace std;

// Iterates though all people in the AddressBook and prints info about them.
void ListPeople(const tutorial::AddressBook&amp; address_book) {
  for (int i = 0; i &lt; address_book.person_size(); i++) {
    const tutorial::Person&amp; person = address_book.person(i);

    cout &lt;&lt; &quot;Person ID: &quot; &lt;&lt; person.id() &lt;&lt; endl;
    cout &lt;&lt; &quot;  Name: &quot; &lt;&lt; person.name() &lt;&lt; endl;
    if (person.has_email()) {
      cout &lt;&lt; &quot;  E-mail address: &quot; &lt;&lt; person.email() &lt;&lt; endl;
    }

    for (int j = 0; j &lt; person.phone_size(); j++) {
      const tutorial::Person::PhoneNumber&amp; phone_number = person.phone(j);

      switch (phone_number.type()) {
        case tutorial::Person::MOBILE:
          cout &lt;&lt; &quot;  Mobile phone #: &quot;;
          break;
        case tutorial::Person::HOME:
          cout &lt;&lt; &quot;  Home phone #: &quot;;
          break;
        case tutorial::Person::WORK:
          cout &lt;&lt; &quot;  Work phone #: &quot;;
          break;
      }
      cout &lt;&lt; phone_number.number() &lt;&lt; endl;
    }
  }
}

// Main function:  Reads the entire address book from a file and prints all
//   the information inside.
int main(int argc, char* argv[]) {
  // Verify that the version of the library that we linked against is
  // compatible with the version of the headers we compiled against.
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  if (argc != 2) {
    cerr &lt;&lt; &quot;Usage:  &quot; &lt;&lt; argv[0] &lt;&lt; &quot; ADDRESS_BOOK_FILE&quot; &lt;&lt; endl;
    return -1;
  }

  tutorial::AddressBook address_book;

  {
    // Read the existing address book.
    fstream input(argv[1], ios::in | ios::binary);
    if (!address_book.ParseFromIstream(&amp;input)) {
      cerr &lt;&lt; &quot;Failed to parse address book.&quot; &lt;&lt; endl;
      return -1;
    }
  }

  ListPeople(address_book);

  // Optional:  Delete all global objects allocated by libprotobuf.
  google::protobuf::ShutdownProtobufLibrary();

  return 0;
}
</code></pre><h4 id="cat-Makefile"><a href="#cat-Makefile" class="headerlink" title="cat Makefile"></a>cat Makefile</h4><pre><code>CC     = g++
FLAGS  = -Wall
PRO_F  = addressbook
PRO_SRC= $(PRO_F).pb.cc
LIBS   = -lprotobuf
TARGET = pb_write pb_read

all:$(TARGET) 

pb_write: proto_file 
    $(CC) $(FLAGS) $(LIBS) -o $@ pb_write.cc $(PRO_SRC)

pb_read: proto_file 
    $(CC) $(FLAGS) $(LIBS) -o $@ pb_read.cc $(PRO_SRC)

proto_file: $(PRO_F).proto
    protoc -I=./ --cpp_out=./ $(PRO_F).proto

.PHONEY:clean 
clean:
    rm -f $(TARGET) $(OBJS) $(PRO_F).pb.h $(PRO_F).pb.cc
</code></pre><h4 id="Files"><a href="#Files" class="headerlink" title="Files:"></a>Files:</h4><pre><code>[dennis@localhost google-code-sample]$ ls
addressbook.proto  Makefile  pb_read.cc  pb_write.cc
</code></pre><h4 id="Compile-and-run"><a href="#Compile-and-run" class="headerlink" title="Compile and run:"></a>Compile and run:</h4><pre><code>[dennis@localhost google-code-sample]$ make
protoc -I=./ --cpp_out=./ addressbook.proto
g++ -Wall -lprotobuf -o pb_write pb_write.cc addressbook.pb.cc
g++ -Wall -lprotobuf -o pb_read pb_read.cc addressbook.pb.cc
[dennis@localhost google-code-sample]$ ls
addressbook.pb.cc  addressbook.pb.h  addressbook.proto  Makefile  pb_read  pb_read.cc  pb_write  pb_write.cc
[dennis@localhost google-code-sample]$ ./pb_write dennis
dennis: File not found.  Creating a new file.
Enter person ID number: 13
Enter name: dennis
Enter email address (blank for none): dennis.cpp@gmail.com
Enter a phone number (or leave blank to finish): 14159265358
Is this a mobile, home, or work phone? mobile
Enter a phone number (or leave blank to finish): 
[dennis@localhost google-code-sample]$ ./pb_write dennis
Enter person ID number: 19
Enter name: tina
Enter email address (blank for none): tina.mm@gmail.com
Enter a phone number (or leave blank to finish): 21714169628
Is this a mobile, home, or work phone? home 
Enter a phone number (or leave blank to finish): 
[dennis@localhost google-code-sample]$ ./pb_read dennis
Person ID: 13
  Name: dennis
  E-mail address: dennis.cpp@gmail.com
  Mobile phone #: 14159265358
Person ID: 19
  Name: tina
  E-mail address: tina.mm@gmail.com
  Home phone #: 21714169628
[dennis@localhost google-code-sample]$ ls
addressbook.pb.cc  addressbook.pb.h  addressbook.proto  dennis  Makefile  pb_read  pb_read.cc  pb_write  pb_write.cc
</code></pre><h4 id="Problem"><a href="#Problem" class="headerlink" title="Problem:"></a>Problem:</h4><p>solution of error while loading shared libraries,<br>look <a href="../../../../2014/06/07/solution-of-error-while-loading-shared-libraries">here</a><br>for details.</p>
<h4 id="Reference"><a href="#Reference" class="headerlink" title="Reference:"></a>Reference:</h4><ul>
<li><a href="https://developers.google.com/protocol-buffers/docs/cpptutorial" target="_blank" rel="external">Protocol Buffer Basics: C++</a></li>
</ul>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/07/use-protobuf/" data-id="ciqqpe1pa008znmpvkrj0c9ch" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/c/">c++</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/protobuf/">protobuf</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-solution-of-error-while-loading-shared-libraries" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/07/solution-of-error-while-loading-shared-libraries/" class="article-date">
  <time datetime="2014-06-06T16:00:00.000Z" itemprop="datePublished">2014-06-07</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/07/solution-of-error-while-loading-shared-libraries/">solution of error while loading shared libraries</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <p>After I finish compile and install protobuf on my machine, then I flow the tutorial<br>to compile the sample code, but after that I can not run it, the error message is<br>as below: </p>
<pre><code>[dennis@localhost google-code-sample]$ vim addressbook.proto 
[dennis@localhost google-code-sample]$ ls
addressbook.proto
[dennis@localhost google-code-sample]$ protoc -I=./ --cpp_out=./ ./addressbook.proto 
[dennis@localhost google-code-sample]$ ls
addressbook.pb.cc  addressbook.pb.h  addressbook.proto
[dennis@localhost google-code-sample]$ vim pb_sample.cc
[dennis@localhost google-code-sample]$ ls
addressbook.pb.cc  addressbook.pb.h  addressbook.proto pb_sample.cc
[dennis@localhost google-code-sample]$ c++ addressbook.pb.cc pb_sample.cc -o pb_sample -lprotobuf
[dennis@localhost google-code-sample]$ ls
addressbook.pb.cc  addressbook.pb.h  addressbook.proto  pb_sample  pb_sample.cc
[dennis@localhost google-code-sample]$ ./pb_sample 
./pb_sample: error while loading shared libraries: libprotobuf.so.9: cannot open shared object file: No such file or directory
</code></pre><p>But I find the library is exist on /usr/local/lib</p>
<pre><code>[dennis@localhost protobuf]$ ls /usr/local/lib/libproto* -l
-rw-r--r--. 1 root root 19747400 Jun  7 11:49 /usr/local/lib/libprotobuf.a
-rwxr-xr-x. 1 root root      968 Jun  7 11:49 /usr/local/lib/libprotobuf.la
-rw-r--r--. 1 root root  2065712 Jun  7 11:49 /usr/local/lib/libprotobuf-lite.a
-rwxr-xr-x. 1 root root     1003 Jun  7 11:49 /usr/local/lib/libprotobuf-lite.la
lrwxrwxrwx. 1 root root       25 Jun  7 11:49 /usr/local/lib/libprotobuf-lite.so -&gt; libprotobuf-lite.so.9.0.0
lrwxrwxrwx. 1 root root       25 Jun  7 11:49 /usr/local/lib/libprotobuf-lite.so.9 -&gt; libprotobuf-lite.so.9.0.0
-rwxr-xr-x. 1 root root   982744 Jun  7 11:49 /usr/local/lib/libprotobuf-lite.so.9.0.0
lrwxrwxrwx. 1 root root       20 Jun  7 11:49 /usr/local/lib/libprotobuf.so -&gt; libprotobuf.so.9.0.0
lrwxrwxrwx. 1 root root       20 Jun  7 11:49 /usr/local/lib/libprotobuf.so.9 -&gt; libprotobuf.so.9.0.0
-rwxr-xr-x. 1 root root  8343446 Jun  7 11:49 /usr/local/lib/libprotobuf.so.9.0.0
-rw-r--r--. 1 root root 23573484 Jun  7 11:49 /usr/local/lib/libprotoc.a
-rwxr-xr-x. 1 root root      984 Jun  7 11:49 /usr/local/lib/libprotoc.la
lrwxrwxrwx. 1 root root       18 Jun  7 11:49 /usr/local/lib/libprotoc.so -&gt; libprotoc.so.9.0.0
lrwxrwxrwx. 1 root root       18 Jun  7 11:49 /usr/local/lib/libprotoc.so.9 -&gt; libprotoc.so.9.0.0
-rwxr-xr-x. 1 root root  8689345 Jun  7 11:49 /usr/local/lib/libprotoc.so.9.0.0
</code></pre><p>How the sytem know Where the libraries is location? </p>
<pre><code>[dennis@localhost google-code-sample]$ ls /etc/ld.so.c* -l
-rw-r--r--. 1 root root 141410 Jun  7 12:49 /etc/ld.so.cache
-rw-r--r--. 1 root root     43 Jun  7 12:48 /etc/ld.so.conf

/etc/ld.so.conf.d:
total 48
-rw-r--r--. 1 root root 17 Sep  8  2012 atlas-x86_64.conf
-r--r--r--. 1 root root 63 Dec  3  2013 kernel-3.11.10-100.fc18.x86_64.conf
-r--r--r--. 1 root root 63 Nov  4  2013 kernel-3.11.7-100.fc18.x86_64.conf
-r--r--r--. 1 root root 63 Nov 21  2013 kernel-3.11.9-100.fc18.x86_64.conf
-rw-r--r--. 1 root root 17 May  3  2013 libiscsi-x86_64.conf
-rw-r--r--. 1 root root 16 May 29  2013 llvm-x86_64.conf
-rw-r--r--. 1 root root 17 Dec 10 23:50 mysql-x86_64.conf
-rw-r--r--. 1 root root 22 Jul 22  2012 qt-x86_64.conf
-rw-r--r--. 1 root root 24 Feb 26  2013 tracker-x86_64.conf
-rw-r--r--. 1 root root 15 Nov 25  2013 wine-32.conf
-rw-r--r--. 1 root root 17 Nov 25  2013 wine-64.conf
-rw-r--r--. 1 root root 21 Dec 10 03:28 xulrunner-64.conf

[dennis@localhost google-code-sample]$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
</code></pre><p><strong>Solution</strong>, add the library directory to config file, then update </p>
<pre><code>[dennis@localhost google-code-sample]$ su -c &apos;echo &quot;/usr/local/lib&quot; &gt;&gt; /etc/ld.so.conf&apos;
Password: 
[dennis@localhost google-code-sample]$ cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
/usr/local/lib
[dennis@localhost google-code-sample]$ su -c &apos;ldconfig&apos;
Password: 
</code></pre><p>right now, you will see that the timestamp of cache file is new</p>
<pre><code>[dennis@localhost google-code-sample]$ ls /etc/ld.so.cache -l
-rw-r--r--. 1 root root 141410 Jun  7 13:07 /etc/ld.so.cache
</code></pre><p>Reference: </p>
<p><a href="http://blog.csdn.net/sahusoft/article/details/7388617" target="_blank" rel="external">error while loading shared libraries: xxx.so.x错误的原因和解决办法</a></p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/07/solution-of-error-while-loading-shared-libraries/" data-id="ciqqpe1p7008vnmpvpjnlsjcw" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/c/">c++</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/protobuf/">protobuf</a></li></ul>

    </footer>
  </div>
  
</article>


  
    <article id="post-open-source-need-to-master" class="article article-type-post" itemscope itemprop="blogPost">
  <div class="article-meta">
    <a href="/2014/06/06/open-source-need-to-master/" class="article-date">
  <time datetime="2014-06-05T16:00:00.000Z" itemprop="datePublished">2014-06-06</time>
</a>
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/program/">program</a>
  </div>

  </div>
  <div class="article-inner">
    
    
      <header class="article-header">
        
  
    <h1 itemprop="name">
      <a class="article-title" href="/2014/06/06/open-source-need-to-master/">Open source need to master</a>
    </h1>
  

      </header>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h3 id="Google-open-source"><a href="#Google-open-source" class="headerlink" title="Google open source"></a>Google open source</h3><ul>
<li><p><a href="https://code.google.com/p/google-breakpad/" target="_blank" rel="external">breakpad</a><br>  Crash reporting</p>
</li>
<li><p><a href="https://code.google.com/p/gflags/" target="_blank" rel="external">gflags</a><br>  Commandline flags module for C++</p>
</li>
<li><p><a href="https://code.google.com/p/google-glog/" target="_blank" rel="external">glog</a><br>  Logging library for C++</p>
</li>
<li><p><a href="https://code.google.com/p/gperftools/" target="_blank" rel="external">gperftools</a><br>  Fast, multi-threaded malloc() and nifty performance analysis tools</p>
</li>
<li><p><a href="https://code.google.com/p/googletest/" target="_blank" rel="external">gtest</a><br>  Google C++ Testing Framework  </p>
</li>
<li><p><a href="https://code.google.com/p/leveldb/" target="_blank" rel="external">leveldb</a><br>  A fast and lightweight key/value database library by Google.</p>
</li>
<li><p><a href="https://code.google.com/p/protobuf/" target="_blank" rel="external">protobuf</a><br>  Protocol Buffers - Google’s data interchange format</p>
</li>
</ul>
<h3 id="Other"><a href="#Other" class="headerlink" title="Other"></a>Other</h3><ul>
<li><p><a href="http://libevent.org/" target="_blank" rel="external">libevent</a><br>  an event notification library </p>
</li>
<li><p><a href="http://www.carisma.slowglass.com/~tgr/libnl/" target="_blank" rel="external">libnl</a><br>  The libnl suite is a collection of libraries providing APIs to netlink protocol based Linux kernel interfaces. </p>
</li>
<li><p><a href="http://www.nongnu.org/libunwind/" target="_blank" rel="external">libunwind</a><br>  The primary goal of this project is to define a portable and efficient C programming interface (API) to determine the call-chain of a program</p>
</li>
<li><p><a href="https://github.com/mono/mono" target="_blank" rel="external">mono</a>  </p>
</li>
<li><p><a href="https://code.google.com/p/snappy/" target="_blank" rel="external">snappy</a><br>  A fast compressor/decompressor</p>
</li>
<li><p><a href="http://fuse.sourceforge.net/" target="_blank" rel="external">fuse</a><br>  With FUSE it is possible to implement a fully functional filesystem in a userspace program.<br>  <a href="http://sourceforge.net/projects/fuse/files/fuse-2.X/" target="_blank" rel="external">http://sourceforge.net/projects/fuse/files/fuse-2.X/</a></p>
</li>
<li><p><a href="http://fuse.sourceforge.net/sshfs.html" target="_blank" rel="external">sshfs-fuse</a><br>  This is a filesystem client based on the SSH File Transfer Protocol.<br>  Since most SSH servers already support this protocol it is very easy to set up: i.e.<br>  on the server side there’s nothing to do.<br>  On the client side mounting the filesystem is as easy as logging into the server with ssh.<br>  <a href="http://sourceforge.net/projects/fuse/files/sshfs-fuse/2.5/" target="_blank" rel="external">http://sourceforge.net/projects/fuse/files/sshfs-fuse/2.5/</a>  </p>
</li>
<li><p><a href="http://zookeeper.apache.org/" target="_blank" rel="external">zookeeper</a><br>  Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination.</p>
</li>
</ul>
<p>metarates.tar.gz</p>

      
    </div>
    <footer class="article-footer">
      <a data-url="http://yoursite.com/2014/06/06/open-source-need-to-master/" data-id="ciqqpe1p4008snmpvw3fuvaoy" class="article-share-link">Partager</a>
      
      
  <ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/source/">source</a></li></ul>

    </footer>
  </div>
  
</article>


  


  <nav id="page-nav">
    <a class="extend prev" rel="prev" href="/page/7/">&laquo; __('prev')</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/6/">6</a><a class="page-number" href="/page/7/">7</a><span class="page-number current">8</span><a class="page-number" href="/page/9/">9</a><a class="page-number" href="/page/10/">10</a><span class="space">&hellip;</span><a class="page-number" href="/page/18/">18</a><a class="extend next" rel="next" href="/page/9/">__('next') &raquo;</a>
  </nav>
</section>
        
          <aside id="sidebar">
  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Catégories</h3>
    <div class="widget">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/blog/">blog</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/database/">database</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/english/">english</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/kernel/">kernel</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/language/">language</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/linux/">linux</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/math/">math</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/network/">network</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/others/">others</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/person/">person</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/program/">program</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/source/">source</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/storage/">storage</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/tools/">tools</a></li><li class="category-list-item"><a class="category-list-link" href="/categories/windows/">windows</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Mot-clés</h3>
    <div class="widget">
      <ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/FAQ/">FAQ</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/IRC/">IRC</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Translation/">Translation</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/android/">android</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/api/">api</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/assembly/">assembly</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/awk/">awk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/batch/">batch</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/blog/">blog</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/book/">book</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/c/">c++</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/cache/">cache</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/crash/">crash</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/database/">database</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/debug/">debug</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/dot/">dot</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/driver/">driver</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/emacs/">emacs</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/exploit/">exploit</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/file-system/">file system</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/filesystem/">filesystem</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/flowchart/">flowchart</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/gcc/">gcc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/git/">git</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/google/">google</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/graphviz/">graphviz</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hexo/">hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/hosts/">hosts</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iscsi/">iscsi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/java/">java</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/javascript/">javascript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/job/">job</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/json/">json</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/kernel/">kernel</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/linux/">linux</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lisp/">lisp</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/lua/">lua</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/makefile/">makefile</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/malloc/">malloc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/math/">math</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/maxima/">maxima</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory/">memory</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/memory-overflow/">memory overflow</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/mtrace/">mtrace</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/netdisk/">netdisk</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/network/">network</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/others/">others</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/pandoc/">pandoc</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/performance/">performance</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/person/">person</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/protobuf/">protobuf</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/python/">python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/rsync/">rsync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sed/">sed</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/shell/">shell</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/skype/">skype</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sms/">sms</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/source/">source</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/ssh/">ssh</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/stack/">stack</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/storage/">storage</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/study/">study</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/svn/">svn</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/sync/">sync</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/test/">test</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/time/">time</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/tools/">tools</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/valgrind/">valgrind</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vi/">vi</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/vim/">vim</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/virtual/">virtual</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wget/">wget</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/windows/">windows</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/wireshark/">wireshark</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/write/">write</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/xml/">xml</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Nuage de mot-clés</h3>
    <div class="widget tagcloud">
      <a href="/tags/FAQ/" style="font-size: 10px;">FAQ</a> <a href="/tags/IRC/" style="font-size: 10px;">IRC</a> <a href="/tags/Translation/" style="font-size: 13px;">Translation</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/api/" style="font-size: 10px;">api</a> <a href="/tags/assembly/" style="font-size: 10px;">assembly</a> <a href="/tags/awk/" style="font-size: 11px;">awk</a> <a href="/tags/batch/" style="font-size: 14px;">batch</a> <a href="/tags/blog/" style="font-size: 10px;">blog</a> <a href="/tags/book/" style="font-size: 10px;">book</a> <a href="/tags/c/" style="font-size: 16px;">c</a> <a href="/tags/c/" style="font-size: 19px;">c++</a> <a href="/tags/cache/" style="font-size: 10px;">cache</a> <a href="/tags/crash/" style="font-size: 10px;">crash</a> <a href="/tags/database/" style="font-size: 17px;">database</a> <a href="/tags/debug/" style="font-size: 12px;">debug</a> <a href="/tags/dot/" style="font-size: 10px;">dot</a> <a href="/tags/driver/" style="font-size: 10px;">driver</a> <a href="/tags/emacs/" style="font-size: 11px;">emacs</a> <a href="/tags/exploit/" style="font-size: 10px;">exploit</a> <a href="/tags/file-system/" style="font-size: 10px;">file system</a> <a href="/tags/filesystem/" style="font-size: 12px;">filesystem</a> <a href="/tags/flowchart/" style="font-size: 10px;">flowchart</a> <a href="/tags/gcc/" style="font-size: 10px;">gcc</a> <a href="/tags/git/" style="font-size: 12px;">git</a> <a href="/tags/google/" style="font-size: 11px;">google</a> <a href="/tags/graphviz/" style="font-size: 11px;">graphviz</a> <a href="/tags/hexo/" style="font-size: 10px;">hexo</a> <a href="/tags/hosts/" style="font-size: 10px;">hosts</a> <a href="/tags/iscsi/" style="font-size: 14px;">iscsi</a> <a href="/tags/java/" style="font-size: 10px;">java</a> <a href="/tags/javascript/" style="font-size: 10px;">javascript</a> <a href="/tags/job/" style="font-size: 10px;">job</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/kernel/" style="font-size: 14px;">kernel</a> <a href="/tags/linux/" style="font-size: 14px;">linux</a> <a href="/tags/lisp/" style="font-size: 10px;">lisp</a> <a href="/tags/lua/" style="font-size: 10px;">lua</a> <a href="/tags/makefile/" style="font-size: 10px;">makefile</a> <a href="/tags/malloc/" style="font-size: 10px;">malloc</a> <a href="/tags/math/" style="font-size: 11px;">math</a> <a href="/tags/maxima/" style="font-size: 10px;">maxima</a> <a href="/tags/memory/" style="font-size: 11px;">memory</a> <a href="/tags/memory-overflow/" style="font-size: 10px;">memory overflow</a> <a href="/tags/mtrace/" style="font-size: 10px;">mtrace</a> <a href="/tags/netdisk/" style="font-size: 10px;">netdisk</a> <a href="/tags/network/" style="font-size: 20px;">network</a> <a href="/tags/others/" style="font-size: 18px;">others</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a> <a href="/tags/performance/" style="font-size: 16px;">performance</a> <a href="/tags/person/" style="font-size: 11px;">person</a> <a href="/tags/protobuf/" style="font-size: 11px;">protobuf</a> <a href="/tags/python/" style="font-size: 10px;">python</a> <a href="/tags/rsync/" style="font-size: 10px;">rsync</a> <a href="/tags/sed/" style="font-size: 11px;">sed</a> <a href="/tags/shell/" style="font-size: 15px;">shell</a> <a href="/tags/skype/" style="font-size: 11px;">skype</a> <a href="/tags/sms/" style="font-size: 10px;">sms</a> <a href="/tags/source/" style="font-size: 11px;">source</a> <a href="/tags/ssh/" style="font-size: 10px;">ssh</a> <a href="/tags/stack/" style="font-size: 10px;">stack</a> <a href="/tags/storage/" style="font-size: 15px;">storage</a> <a href="/tags/study/" style="font-size: 10px;">study</a> <a href="/tags/svn/" style="font-size: 11px;">svn</a> <a href="/tags/sync/" style="font-size: 10px;">sync</a> <a href="/tags/test/" style="font-size: 11px;">test</a> <a href="/tags/time/" style="font-size: 10px;">time</a> <a href="/tags/tools/" style="font-size: 16px;">tools</a> <a href="/tags/valgrind/" style="font-size: 10px;">valgrind</a> <a href="/tags/vi/" style="font-size: 10px;">vi</a> <a href="/tags/vim/" style="font-size: 14px;">vim</a> <a href="/tags/virtual/" style="font-size: 11px;">virtual</a> <a href="/tags/wget/" style="font-size: 10px;">wget</a> <a href="/tags/windows/" style="font-size: 11px;">windows</a> <a href="/tags/wireshark/" style="font-size: 10px;">wireshark</a> <a href="/tags/write/" style="font-size: 13px;">write</a> <a href="/tags/xml/" style="font-size: 10px;">xml</a>
    </div>
  </div>

  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Archives</h3>
    <div class="widget">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">July 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/04/">April 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/03/">March 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/02/">February 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/01/">January 2016</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/11/">November 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/10/">October 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/09/">September 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/08/">August 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/07/">July 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/06/">June 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/03/">March 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/02/">February 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2015/01/">January 2015</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/12/">December 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/11/">November 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/09/">September 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/08/">August 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/07/">July 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/06/">June 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/05/">May 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/04/">April 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2014/03/">March 2014</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/11/">November 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/10/">October 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/09/">September 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/08/">August 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/07/">July 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/06/">June 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/05/">May 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/04/">April 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/03/">March 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/02/">February 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2013/01/">January 2013</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/12/">December 2012</a></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2012/09/">September 2012</a></li></ul>
    </div>
  </div>


  
    
  <div class="widget-wrap">
    <h3 class="widget-title">Articles récents</h3>
    <div class="widget">
      <ul>
        
          <li>
            <a href="/2016/07/17/how-to-implement-malloc/">如何实现一个malloc</a>
          </li>
        
          <li>
            <a href="/2016/07/17/study-grep-more/">grep工作原理</a>
          </li>
        
          <li>
            <a href="/2016/07/17/2016-04-13-malloc/">malloc</a>
          </li>
        
          <li>
            <a href="/2016/04/27/include-what-you-use/">使用IWYU整理头文件引用</a>
          </li>
        
          <li>
            <a href="/2016/04/24/understand-gcc-assembly-output/">understand gcc assembly output</a>
          </li>
        
      </ul>
    </div>
  </div>

  
</aside>
        
      </div>
      <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2016 Matrix207<br>
      Propulsé by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>
    </div>
    <nav id="mobile-nav">
  
    <a href="/" class="mobile-nav-link">Home</a>
  
    <a href="/archives" class="mobile-nav-link">Archives</a>
  
</nav>
    

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>


  <link rel="stylesheet" href="/fancybox/jquery.fancybox.css">
  <script src="/fancybox/jquery.fancybox.pack.js"></script>


<script src="/js/script.js"></script>

  </div>
</body>
</html>